package com.igeek.boot.mapper;

import com.igeek.boot.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CustomMapper {

    //若想支持动态sql 需要在<script></script>中写sql
    @Update("<script>" +
            "update user " +
            "<set>" +
            "<if test='name!=null'>name=#{name},</if>" +
            "<if test='age!=null'>age=#{age},</if>" +
            "</set>"+
            "where user_id=#{id}"+
            "</script>")
    int updateUserWithSet(User user);
}
